package com.xingyun.kingdee.erp.tools.common;

import com.xingyun.kingdee.erp.tools.common.interfaces.Compatiable;

import java.util.ServiceLoader;

/**
 * @author lingo
 * @version v1.0
 * @date 2020/8/13 14:48
 * @Company www.xyb2b.com
 */

public class ValueCompatibleEnum<T,R> {

    public static final ValueCompatibleEnum<String,Integer> STRING_TO_INTEGER = new ValueCompatibleEnum<>(Integer::valueOf);


    private Class<T> formClass;
    private Class<R> toClass;
    private Compatiable<T, R> changer;

    public ValueCompatibleEnum(Compatiable<T, R> changer) {
        this.formClass = formClass;
        this.toClass = toClass;
        this.changer = changer;
    }

    public static void main(String[] args) {
        ServiceLoader<Compatiable> load = ServiceLoader.load(Compatiable.class);
        for (Compatiable compatiable : load) {
            System.out.println(compatiable.apply(22));
        }
    }
}
